#!/bin/bash
# Create a venv with semgrep installed and run semgrep

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_DIR="$SCRIPT_DIR/.venv"
SEMGREP_EXEC="$VENV_DIR/bin/semgrep"

bazel run //tests/semgrep:venv

# shellcheck source=/dev/null
source "$VENV_DIR"/bin/activate

"$SEMGREP_EXEC" "$@"
